/*	ParentBehavior class definition.
 *
 *
 *
*/

#ifndef ParentBehavior_H_
#define ParentBehavior_H_

#include "BaseBehavior.h"
#include "ParentBehaviorController.h"

class ParentBehavior : public BaseBehavior
{
public:

	ParentBehavior()
    {
		control = new ParentBehaviorController(this);
    }
        
    /**
     * Gets the control reference
     */
    virtual BehaviorController* GetControl()	{	return control;	}
        
    /**
     * Abstract to be overridden in behavior classes. Called when a behavior finishes with failure.
     */
    virtual void BehaviorFailed();

	/**
     * Abstract to be overridden in behavior classes. Called when a behavior finishes with success.
     */
    virtual void BehaviorSucceeded();
        
	/**
     * Checks for the appropiate pre-state of the data
     */
    virtual bool CheckConditions() {	return control->GetSubBehaviors()->size() > 0;	}

    /**
     * Checks whether the behavior has started, finished or needs updating, and takes the needed
     * measures in each case
     */
    virtual void Execute() ;

    /**
     * Starts the task, and points the current task to the first 
     * one of the available child tasks.
     */
    virtual void Enter();
	
	/**
     * Ends the behavior
     */
    virtual void Exit();

protected:
	ParentBehaviorController* control;

private:


};

#endif
